<?php

declare(strict_types=1);

namespace app\api\controller\v1;
use app\common\Frontend;
use app\common\model\PublicStatus;
use app\common\model\Subscribe as ModelSubscribe;
use app\common\model\VipPrice;
use app\common\model\VipType;

class Subscribe extends Frontend
{

    protected array $noNeedLogin = ['subscribeList'];

    protected $model;
    public function initialize(): void
    {
        parent::initialize();
        $this->model = new ModelSubscribe();
    }


    //类型数据源
    public function subscribeList() : void {
        $res =$this->model->where(['status'=>PublicStatus::PUBLIC_STATUS_ONE])->order('weigh asc')->select()->each(function($item,$key){
            $item['subscribe_json_content'] = json_decode($item['subscribe_json'],true);
            return $item;
        });
        $this->success('', [
            'list'   => $res,
            'remark' => '',
        ]);
    }
}